package no.nordicsemi.android.nrftoolbox;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;

import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;

import no.nordicsemi.android.nrftoolbox.scanner.ScanActivity;
import no.nordicsemi.android.nrftoolbox.scanner.ScanBatchActivity;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.acitivity_main);
        final Toolbar toolbar  = findViewById(R.id.toolbar_actionbar);
        setSupportActionBar(toolbar);
        Log.d("Main","on create");

        init();
    }

    public void init () {
        findViewById(R.id.ble_scan).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ////////////////////////
                // direct to ble scan acitivity
                ////////////////////////
                final Intent intent = new Intent(MainActivity.this, ScanActivity.class);
                startActivity(intent);
            }
        });

        findViewById(R.id.ble_search).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ////////////////////////
                // direct to ble search activity
                ////////////////////////
                final Intent intent = new Intent(MainActivity.this,
                        ScanBatchActivity.class);
                startActivity(intent);

                //********************
                // ** start from here test the continually connect multiple device one by one
                //********************
//                final Intent intent_1 = new Intent(MainActivity.this, ReqActivity.class);
//                startActivity(intent_1);

            }
        });
    }
}
